package com.jsh.erp.datasource.mappers;

import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.vo.*;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Description
 *
 * @Author: cjl
 * @Date: 2019/1/25 14:50
 */
public interface DepotHeadMapperEx {
    List<DepotHeadVo4List> selectByConditionDepotHead(
            @Param("typeList")  List<String> typeList,
            @Param("subTypeList") List<String> subTypeList,
            @Param("creatorArray") String[] creatorArray,
            @Param("statusArray") String[] statusArray,
            @Param("purchaseStatusArray") String[] purchaseStatusArray,
            @Param("number") String number,
            @Param("linkNumber") String linkNumber,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("materialParam") String materialParam,
            @Param("organId") String organId,
            @Param("creator") String creator,
            @Param("depotId") String depotId,
            @Param("depotArray") String[] depotArray,
            @Param("accountId") String accountId,
            @Param("remark") String remark,
            @Param("custom3") String custom3,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("payStatus") String payStatus,
            @Param("freightStatus") String freightStatus,
            @Param("quotationStatusArray") String[] quotationStatusArray,
            @Param("custom4") String custom4,
            @Param("color") String color,
            @Param("alwaysSelect") String alwaysSelect,
            @Param("itemType") String itemType,
            @Param("creditStatus") String creditStatus,
            @Param("depotStatus") String depotStatus,
            @Param("depotArrays") String[] depotArrays,
            @Param("column") String column,
            @Param("order") String order);

    Long countsByDepotHead(
            @Param("typeList")  List<String> typeList,
            @Param("subTypeList") List<String> subTypeList,
            @Param("creatorArray") String[] creatorArray,
            @Param("statusArray") String[] statusArray,
            @Param("purchaseStatusArray") String[] purchaseStatusArray,
            @Param("number") String number,
            @Param("linkNumber") String linkNumber,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("materialParam") String materialParam,
            @Param("organId") String organId,
            @Param("creator") String creator,
            @Param("depotId") String depotId,
            @Param("depotArray") String[] depotArray,
            @Param("accountId") String accountId,
            @Param("remark") String remark,
            @Param("custom3") String custom3,
            @Param("payStatus") String payStatus,
            @Param("freightStatus") String freightStatus,
            @Param("quotationStatusArray") String[] quotationStatusArray,
            @Param("custom4") String custom4,
            @Param("color") String color,
            @Param("alwaysSelect") String alwaysSelect,
            @Param("itemType") String itemType,
            @Param("creditStatus") String creditStatus,
            @Param("depotStatus") String depotStatus,
            @Param("depotArrays") String[] depotArrays);

    String findMaterialsListByHeaderId(
            @Param("id") String id);

    List<DepotHeadVo4InDetail> findByAll(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("flag") String flag,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("otherStatus") String otherStatus,
            @Param("idList") List<String> idList);

    int findByAllCount(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("flag") String flag,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("otherStatus") String otherStatus,
            @Param("idList") List<String> idList);

    List<DepotHeadVo4InOutMCount> findInOutMaterialCount(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("flag") String flag,
            @Param("idList") List<String> idList);

    int findInOutMaterialCountTotal(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("flag") String flag,
            @Param("idList") List<String> idList);

    List<DepotHeadVo4InDetail> findAllocationDetail(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("subTypeList") List<String> subTypeList,
            @Param("number") String number,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("depotFList") List<String> depotFList,
            @Param("remark") String remark,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("creator") String creator,
            @Param("materialId") String materialId,
            @Param("idList") List<String> idList);

    int findAllocationDetailCount(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("subTypeList") List<String> subTypeList,
            @Param("number") String number,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("depotFList") List<String> depotFList,
            @Param("remark") String remark,
            @Param("creator") String creator,
            @Param("materialId") String materialId,
            @Param("idList") List<String> idList);

    List<DepotHeadVo4StatementAccount> getStatementAccount(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("organId") String organId,
            @Param("supplierType") String supplierType,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("type1") String type1,
            @Param("subType1") String subType1,
            @Param("accountType") String accountType,
            @Param("zeroAmount") Integer zeroAmount,
            @Param("tenantId") String tenantId);

    int getStatementAccountCount(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("organId") String organId,
            @Param("supplierType") String supplierType,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("type1") String type1,
            @Param("subType1") String subType1,
            @Param("accountType") String accountType,
            @Param("zeroAmount") Integer zeroAmount,
            @Param("tenantId") String tenantId);

    List<DepotHeadVo4StatementAccount> getStatementAccountTotalPay(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("organId") String organId,
            @Param("supplierType") String supplierType,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("type1") String type1,
            @Param("subType1") String subType1,
            @Param("accountType") String accountType,
            @Param("tenantId") String tenantId);

    BigDecimal findAllMoney(
            @Param("supplierId") String supplierId,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("modeName") String modeName,
            @Param("endTime") String endTime,
            @Param("type1") String type1,
            @Param("subType1") String subType1);

    BigDecimal findAllOtherMoney(
            @Param("supplierId") String supplierId,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("endTime") String endTime,
            @Param("type1") String type1,
            @Param("subType1") String subType1);

    BigDecimal findDepositMoney(
            @Param("supplierId") String supplierId,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("endTime") String endTime,
            @Param("type1") String type1,
            @Param("subType1") String subType1);

    List<DepotHeadVo4List> getDetailByNumber(
            @Param("number") String number);

    List<DepotHeadVo4List> getHeadByLinkNumber(
            @Param("linkNumber") String linkNumber);

    List<DepotHeadVo4List> getInHeadByLinkNumber(
            @Param("linkNumber") String linkNumber);

    int batchDeleteDepotHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") String updater, @Param("ids") String ids[]);

    List<DepotHead> getDepotHeadListByAccountIds(@Param("accountIds") String[] accountIds);

    List<DepotHead> getDepotHeadListByOrganIds(@Param("organIds") String[] organIds);

    List<DepotHead> getDepotHeadListByCreator(@Param("creatorArray") String[] creatorArray);

    BigDecimal getBuyAndSaleBasicStatistics(
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("hasSupplier") Integer hasSupplier,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type1") String type1,
            @Param("subType1") String subType1);

    BigDecimal getBuyAndSaleRetailStatistics(
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type1") String type1,
            @Param("subType1") String subType1);

    List<DepotHeadVo4List> debtList(
            @Param("organId") String organId,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("creatorArray") String[] creatorArray,
            @Param("status") String status,
            @Param("number") String number,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("materialParam") String materialParam,
            @Param("depotArray") String[] depotArray,
            @Param("type1") String type1,
            @Param("subType1") String subType1,
            @Param("pageNum") Integer pageNum,
            @Param("pageSize") Integer pageSize);

    BigDecimal getFinishDepositByNumber(
            @Param("number") String number);

    BigDecimal getFinishDepositByNumberExceptCurrent(
            @Param("linkNumber") String linkNumber,
            @Param("number") String number);


    List<RequireGoodsVo> requireGoods(@Param("status") String status,@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize);

    List<FactoryOutLetVo> factoryOutLet(@Param("beginTime") String beginTime,
                                        @Param("endTime") String endTime,
                                        @Param("number") String number,
                                        @Param("organId") String organId,
                                        @Param("pageNum") Integer pageNum,
                                        @Param("pageSize") Integer pageSize);

    List<RequireDetailsVo> requireGoodsDetails(@Param("defaultNumber") String defaultNumber);

    List<FactoryOutLetDetailVo> factoryOutLetDetails(@Param("headerId") String headerId);

    List<DepotHeadVo4InOutMCount> findPromotionMaterialCount(
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("idList") List<String> idList,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);

    int findPromotionMaterialCountTotal(
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("idList") List<String> idList);


    List<DepotHeadVo4List> purchaseAlert(@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize,@Param("dayNum") Integer dayNum);

    List<DepotHeadVo4List> manufacturerWarning(@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize,@Param("dayNum") Integer dayNum);


    List<DepotHeadVo4List> purchaseApplicationAlert(@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize,@Param("dayNum") Integer dayNum);

    List<AccountHeadWIthPaymentWarning> paymentWarning(@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize,@Param("dayNum") Integer dayNum);

    List<ShelfLifeWarningVo> shelfLifeWarning(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize,@Param("tenantId")String tenantId);

    List<DepotHeadWithPos> getShoppingRunningWater(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("orderNumber") String orderNumber,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);

    int getShoppingRunningWaterCount(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("orderNumber") String orderNumber);

    List<DepotHeadWithPos> getSaleShoppingRunningWater(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("orderNumber") String orderNumber,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);

    int getSaleShoppingRunningWaterCount(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("orderNumber") String orderNumber
    );

    DepotHeadWithPos searchOrder_v1(
            @Param("orderNumber") String orderNumber);

    List<DepotHead> selectInfoDepotHead(@Param("subType") String subType,@Param("depotList") List<String> depotList);

    List<DepotHead> selectDeliveryDepotHead(@Param("subType") String subType,@Param("depotList") List<String> depotList);
    List<DepotHead> selectPurchaseDepotHead(@Param("subType") String subType,@Param("depotList") List<String> depotList);

    List<DepotHead> getDepotHeadByOrganId(@Param("organId") String organId, @Param("type") String type, @Param("subType") String subType, @Param("type1") String type1, @Param("subType1") String subType1);

    List<ReconciliationVoList> getAllBillItemByOrganId(@Param("organId") String organId,
                                                       @Param("beginTime") String beginTime,
                                                       @Param("endTime") String endTime,
                                                       @Param("pageNum") Integer pageNum,
                                                       @Param("pageSize") Integer pageSize);

    Integer getAllBillItemByOrganIdCount(@Param("organId") String organId,
                                 @Param("beginTime") String beginTime,
                                 @Param("endTime") String endTime);

    List<AccountHeadWIthPaymentWarning> paymentWarning(
            @Param("organId") String organId,
            @Param("status") String status,
            @Param("number") String number,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotArray") String[] depotArray,
            @Param("pageNum") Integer pageNum,
            @Param("pageSize") Integer pageSize,
            @Param("day") Integer day);

    List<AccountHeadWIthTracking> purchaseOrderTracking(
            @Param("organId") String organId,
            @Param("depotId") String depotId,
            @Param("number") String number,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotArray") String[] depotArray,
            @Param("pageNum") Integer pageNum,
            @Param("pageSize") Integer pageSize,
            @Param("materialName") String materialName);


    List<DepotHeadTraceDetail> trackingDetailList(
            @Param("linkNumber") String linkNumber,
            @Param("type") String type,
            @Param("subType") String subType);

    List<DepotHeadTraceDetail> breakOrChangeDetail(
            @Param("linkNumber") String linkNumber,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("orderType") Integer orderType);

    List<DepotHeadTraceDetail> breakOrChangeDetailByStraight(
            @Param("linkNumber") String linkNumber,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("orderType") Integer orderType);
    List<DepotHeadTraceDetail> breakOrChangeDetailBySales(
            @Param("linkNumber") String linkNumber,
            @Param("type") String type,
            @Param("subType") String subType,
            @Param("orderType") Integer orderType);

    List<DepotHeadTraceDetail> straightTrackingDetailList(
            @Param("linkNumber") String linkNumber,
            @Param("type") String type,
            @Param("subType") String subType);

    List<DepotHeadTraceDetail> getPurchaseDetail(
            @Param("number") String number);


    BigDecimal getTotal(@Param("defaultNumber") String defaultNumber);

    BigDecimal getReceivedQuantity(@Param("defaultNumber") String defaultNumber,@Param("goToType") String goToType);

    BigDecimal getSalesReturnQuantity(@Param("defaultNumber") String defaultNumber);

    String getClientNameByNumber(@Param("number") String number);


    List<DepotHeadWithStaffSales> findPromotionCreatorCount(
            @Param("creator") String creator,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("organId") String organId);

    int findPromotionCreatorCountTotal(
            @Param("creator") String creator,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("organId") String organId);

    BigDecimal findReturnPriceByCreator(@Param("creator") String creator,
                                        @Param("beginTime") String beginTime,
                                        @Param("endTime") String endTime);

    List<DepotHeadWithStaffSalesDetail> findDepotByCreatorDetail(
            @Param("creator") String creator,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("organId") String organId);

    int findDepotByCreatorDetailTotal(
            @Param("creator") String creator,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("organId") String organId);

    List<DepotHeadWithRebate> findRebate(
            @Param("creator") String creator,
            @Param("organId") String organId,
            @Param("number") String number,
            @Param("custom12") Integer custom12,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);
    int findRebateTotal(
            @Param("creator") String creator,
            @Param("organId") String organId,
            @Param("number") String number,
            @Param("custom12") Integer custom12,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime);

    int updateCustom12ByBillId(@Param("billId") String billId);

    List<DepotHeadVo4List> selectSalesOrderByConditionDepotHead(
            @Param("typeList")  List<String> typeList,
            @Param("subTypeList") List<String> subTypeList,
            @Param("statusArray") String[] statusArray,
            @Param("number") String number,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("materialParam") String materialParam,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);

    Long countsSalesOrderByDepotHead(
            @Param("typeList")  List<String> typeList,
            @Param("subTypeList") List<String> subTypeList,
            @Param("statusArray") String[] statusArray,
            @Param("number") String number,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("materialParam") String materialParam);

    List<DepotHeadVo4List> getSalesHeadByLinkNumber(
            @Param("linkNumber") String linkNumber);

    List<DepotHeadWithItem> findPromotionMaterialDetail(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("idList") List<String> idList);
    Long findPromotionMaterialDetailTotal(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("idList") List<String> idList);

    List<DepotHeadWithItem> findCheckMaterialDetail(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("materialId") String materialId);
    Long findCheckMaterialDetailTotal(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("materialId") String materialId);

    List<DepotHeadWithItem> findPackageMaterialDetail(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("idList") List<String> idList);
    Long findPackageMaterialDetailTotal(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("type") String type,
            @Param("materialParam") String materialParam,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("number") String number,
            @Param("remark") String remark,
            @Param("subType") String subType,
            @Param("creator") String creator,
            @Param("idList") List<String> idList);


    List<SalesMarginVo> findSalesMarginList(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("creator") String creator,
            @Param("marginType") Integer marginType,
            @Param("materialName") String materialName);
    Long findSalesMarginListTotal(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("creator") String creator,
            @Param("marginType") Integer marginType,
            @Param("materialName") String materialName);

    List<SalesMarginDetailVo> findSalesMarginDetail(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows,
            @Param("creator") String creator,
            @Param("marginType") Integer marginType,
            @Param("materialName") String materialName,
            @Param("materialId") String materialId,
            @Param("idList") List<String> idList);
    Long findSalesMarginDetailTotal(
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("depotList") List<String> depotList,
            @Param("oId") String oId,
            @Param("creator") String creator,
            @Param("marginType") Integer marginType,
            @Param("materialName") String materialName,
            @Param("materialId") String materialId,
            @Param("idList") List<String> idList);

    //销售订单追踪
    List<SalesOrderTracking> salesOrderTracking(
            @Param("organId") String organId,
            @Param("depotId") String depotId,
            @Param("number") String number,
            @Param("beginTime") String beginTime,
            @Param("endTime") String endTime,
            @Param("pageNum") Integer pageNum,
            @Param("pageSize") Integer pageSize);


    DepotHeadVo4List selectByHeaderId(
            @Param("headerId")  String headerId);

    BigDecimal getRefundsByNumber(
            @Param("number") String number);

    BigDecimal getRefundsByOutNumber(
            @Param("number") String number);

    int insertList(@Param("list")List<DepotHead> list);

    int deleteByListId(@Param("idList") List<String> idList);

    int updateList(@Param("list")List<DepotHead> list);
}
